/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui;
import java.awt.event.MouseListener;
import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JOptionPane;
/**
 *
 * @author stormovik
 */
import java.awt.BorderLayout;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
public class WeekView extends JPanel{
    String Headers[] ={"Time","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    String Time[][] = 
    {
        {"8.00","1","2","3","4","5","6","7"},
        {"9.00","1","2","3","4","5","6","7"},
        {"10.00","1","2","3","4","5","6","7"},
        {"11.00","1","2","3","4","5","6","7"},
        {"12.00","1","2","3","4","5","6","7"},
        {"13.00","1","2","3","4","5","6","7"},
        {"14.00","1","2","3","4","5","6","7"},
        {"15.00","1","2","3","4","5","6","7"},
        {"16.00","1","2","3","4","5","6","7"},
        {"17.00","1","2","3","4","5","6","7"},
        {"18.00","1","2","3","4","5","6","7"},
        {"19.00","1","2","3","4","5","6","7"},
        {"20.00","1","2","3","4","5","6","7"},
        {"21.00","1","2","3","4","5","6","7"},
        {"22.00","1","2","3","4","5","6","7"},
    };
    JTable timetable = new JTable(Time,Headers);
    public WeekView()
    {
        BuildUI();
    }
    public void BuildUI()
    {
        this.setLayout(new BorderLayout());
        this.setBackground(Color.BLUE);
        timetable.setFillsViewportHeight(true);
        JScrollPane pane = new JScrollPane(timetable);
        timetable.setRowSelectionAllowed(false);
        timetable.setCellSelectionEnabled(true);
        timetable.addMouseListener(new MouseListener()
        {
            @Override
            public void mouseExited(java.awt.event.MouseEvent e){}
            @Override
            public void mouseEntered(java.awt.event.MouseEvent e){}
            @Override
            public void mouseReleased(java.awt.event.MouseEvent e)
            {
                JOptionPane.showMessageDialog(new JPanel(), "You clicked on"+timetable.getSelectedRow());
            }
            @Override
            public void mousePressed(java.awt.event.MouseEvent e){}
            @Override
            public void mouseClicked(java.awt.event.MouseEvent e){}
            
        });
        //timetable.setPreferredSize(new Dimension(100,100));a
        this.add(pane,BorderLayout.CENTER);
        this.setBackground(Color.BLUE);
        this.setVisible(true);
    }
}
